package com.ty.day5;

import java.util.Scanner;

/**
 * Created by IntelliJ IDEA.
 * Author : txy
 * Create 2023/11/1 10:31
 */
public class One {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个4位数整数：");
        int x = sc.nextInt(), y = 0, t = x;
        if (x > 9999 || x < 1000) {
            System.out.println("数据输入不合法！");
            return;
        }
        while (t > 0) {
            y = y * 10 + ((t % 10) + 5) % 10;//交换位置相当于逆序输出，先取出每一个数字加5，再除10取余
            t = t / 10;
        }
        System.out.println("加密后：" + y);
    }
}
